#include "Viewport.h"
#include "Game.h"
#include "Window.h"

int Viewport::offsetX = 0;

void Viewport::calcOffsets()
{
	int px = Game::getInstance()->getPlayer()->getX();

    int halfWidth = Window::getInstance()->getWidth() >> 1;

	/*
	bool flipped = Game::getInstance()->getPlayer()->isFlipped();

	int lookahead = -60;
	if (flipped) lookahead *= -1;

	int dx = (halfWidth - px + lookahead) - offsetX;
	offsetX += (int)((float)dx * 0.05f);
	*/
	offsetX = halfWidth - px;

    if(offsetX > 0) offsetX = 0;
}

int Viewport::drawX(int x){
    return x + offsetX;
}

int Viewport::drawY(int y){
    return Window::getInstance()->getHeight() - y - 21 - 60;
}
